package com.groupbuying.provider.controller;

import com.groupbuying.provider.dto.forManage.LoginDTO;
import com.groupbuying.provider.service.StoreAccountService;
import com.groupbuying.provider.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @author ywxd
 * @version V1.0
 */

@Api("服务商登录")
@RequestMapping()
@RestController
public class StoreLoginController {
    @Autowired
    StoreAccountService storeAccountService;

    //@Log("登录")
    @PostMapping("/login")
    public R login(@Valid @RequestBody LoginDTO loginDTO, HttpServletRequest request, HttpServletResponse response) {
        return storeAccountService.internal_login(loginDTO);
    }

    @RequestMapping("/logout")
    public R logout(HttpServletRequest request, HttpServletResponse response) {
        //menuService.clearCache(FilterContextHandler.getUserID());
        return R.ok();
    }

}
